package com.ck.ips.service.impl.program;

import com.ck.common.model.OperationResult;
import com.ck.common.model.ProgramReducedLog;
import com.ck.ips.dao.program.ProgramReducedLogMapper;
import com.ck.ips.model.vo.program.ProgramReducedLogVO;
import com.ck.ips.service.program.ProgramReducedLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @author linqiang
 * @version v1.0
 * @Description 减播Service实现类
 * @date 2019-04-29 16:48
 */
@Service(value = "programReducedLogService")
public class ProgramReducedLogServiceImpl implements ProgramReducedLogService {

    @Autowired
    private ProgramReducedLogMapper programReducedLogMapper;

    /**
     * 新增
     *
     * @param record 数据
     * @return 影响行数
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insert(ProgramReducedLog record) {
        return programReducedLogMapper.insert(record);
    }

    /**
     * 批量新增
     *
     * @param programReducedLogList 数据
     * @return 影响行数
     */
    @Override
    public int batchInsert(List<ProgramReducedLog> programReducedLogList) {
        return programReducedLogMapper.batchInsert(programReducedLogList);
    }

    /**
     * 列表查询
     *
     * @param deviceCode 终端序列号
     * @return OperationResult
     */
    @Override
    public OperationResult list(String deviceCode) {
        return OperationResult.newSuccessOperationResult(programReducedLogMapper.list(deviceCode));
    }

    /**
     * 根据节目版本号删除
     *
     * @param programVersionList
     * @return
     */
    @Override
    public int batchDelete(List<String> programVersionList) {
        return programReducedLogMapper.batchDelete(programVersionList);
    }
}
